﻿using System.Linq;
using Moq;
using NUnit.Framework;
using SportsStore.Domain.Abstract;
using SportsStore.Domain.Entities;

namespace SportsStore.UnitTests {

  public static class UnitTestHelpers {

    public static void ShouldEqual<T>(this T actualValue, T expectedValue) {
      Assert.AreEqual(expectedValue, actualValue);
    }

    public static IProductsRepository MockProductsRepository(params Product[] prods) {
      // Generate an implementer of IProductsRepository at runtime using Moq
      var mockProductsRepos = new Mock<IProductsRepository>();
      mockProductsRepos.Setup(x => x.Products).Returns(prods.AsQueryable());
      return mockProductsRepos.Object;
    }

  }

}
